int sum1(struct TreeNode* root)
{
    if (root == NULL)
    {
        return 0;
    }
    int a = root->val + sum1(root->left) + sum1(root->right);
    return a;
}

void getsum(struct TreeNode* root, int* sum)
{
    if (root == NULL || root->left == root->right)
    {
        return;
    }
    *sum = *sum + abs(sum1(root->left) - sum1(root->right));
    printf("%d\n", abs(sum1(root->left) - sum1(root->right)));
    getsum(root->left, sum);
    getsum(root->right, sum);

}

int findTilt(struct TreeNode* root) {
    int sum = 0;
    getsum(root, &sum);
    return sum;
}